• WINDOID is great! It has been a big help to see those example scripts and learn new features and tricks. Especially things that are not shown in Goodman's book (Ed: Danny Goodman - The Complete HyperCard Handbook - Bantam) or other places. Since I've learned so much from WINDOID, I'd like to share a script with the other readers.
How can you get several scrollable fields to all scroll together?
Put these two handlers in your card script.
On openCard
global initScroll
put 0 into initScroll
repeat with i = 2 to 5
set the scroll of card field i to initScroll
end repeat
end openCard
The script above simply sets all the scrollable fields you want (in this case fields 2 thru 5) to zero - elevator at the top of the scroll bar. It also stores that scroll value (zero) in a global variable (initScroll).
on updateScroll
global initScroll
repeat with i = 2 to 5
set the scroll of card field i to initScroll
end repeat
end updateScroll
This is the workhorse script. It sets the scroll of the fields you want, all equal to the variable initScroll. initScroll gets changed by the user scrolling one of the fields. That's what the next script does.
Put the following script in each of the scrollable fields.
on mouseWithin
global initScroll
if the scroll of me <> initScroll then
get the scroll of me
put it into initScroll
updateScroll
end if
end mouseWithin
The above script detects changes in a field's scroll bar and changes the value of the global variable initScroll. Then it calls the updateScroll script (on the card) to change all appropriate fields to the same value.
These scripts are great for creating tabular style fields that can scroll and yet keep all the info lined up between fields. It helps to lay out the fields so that their tops and bottoms are even.